package week01;

public class Caller {
        public static void main(String[] args) {
	// write your code here
      //  System.out.println("Hello Word");
            TicketMaker tm1 = TicketMaker.getInstance();
            TicketMaker tm2 = TicketMaker.getInstance();
            TicketMaker tm3 = TicketMaker.getInstance();

            showInfo(tm1.getNextTicketNumber());
            showInfo(tm2.getNextTicketNumber());
            showInfo(tm3.getNextTicketNumber());
            showInfo(tm1.getNextTicketNumber());
            showInfo(tm3.getNextTicketNumber());
            showInfo(tm2.getNextTicketNumber());
            showInfo(tm3.getNextTicketNumber());
            showInfo(tm2.getNextTicketNumber());
            showInfo(tm1.getNextTicketNumber());
            showInfo(tm3.getNextTicketNumber());

            if(tm1 == tm2){
                System.out.println("创建的是同一个实例");
            }else{
                System.out.println("创建的不是同一个实例");
            }
        }
        private static void showInfo(int ticketNumber){
            System.out.println("出票成功！票号："+ticketNumber);
        }
}
